import Vue from 'vue';

window.loadScripts = function (srcs, callback) {
    let loaded = 0;
    let scripts = [];
    for (let i = 0; i < srcs.length; i++) {
        scripts[i] = document.createElement('script');
        scripts[i].src = srcs[i];
        scripts[i].onload = function () {
            loaded++;
            if (loaded === srcs.length && callback) {
                callback();
            }
        };
        document.body.appendChild(scripts[i]);
    }
};